
package com.market.web.action;

import com.market.bean.Customer;
import com.market.bean.Subknowledge;
import com.market.web.form.CustomerForm;

public class ModifyInfAction extends CustomerAction
{
    public String execute() throws Exception
    {
        CustomerForm cusf = (CustomerForm)getRequest().getSession().getAttribute("cus");
        Customer cus = getCustomerService().FindById(cusf.getId());
        Object[] knowList = cus.getSubknowledges().toArray();
        String[] know = new String[knowList.length];
        for (int i = 0; i < knowList.length; i++)
        {
            Subknowledge k = (Subknowledge)knowList[i];
            know[i] = k.getCategory();
        }
        Object[] newsList = cus.getSubknowledges().toArray();
        String[] news = new String[newsList.length];
        for (int i = 0; i < newsList.length; i++)
        {
            Subknowledge n = (Subknowledge)newsList[i];
            news[i] = n.getCategory();
        }
        cusf.setSubknow(know);
        cusf.setSubnews(news);
        cusf.setRepass(cusf.getPass());
        getRequest().setAttribute("customerForm", cusf);
        return SUCCESS;//mapping.findForward("modifyInf");
    }
}
